function I = Logistic(img)
%Logistic 混沌映射
% 0 <= x <= 1 && 3.5699456 <= u <= 4 
x = 0.20220415;
u = 3.620220415;
[H, M] = size(img);

%迭代500次，达到充分混沌状态
for i = 1: 500
    x = u * x * (1 - x);
end

%产生一维混沌加密序列
A = zeros(1, H * M);
A(1) = x;
for i = 1: H * M - 1
    A(i + 1) = u * A(i) * (1 - A(i));
end
for i = 1: H * M - 1
    A(i) = mod(floor(A(i) * pow2(48)), 256);
end
B = reshape(A,H,M);
B = uint8(B);
I = bitxor(img,B);
end